<template>
  <div class="container">
    <CommonTitle><p slot="title">待办事项</p></CommonTitle>
    <div class="pieBox">
      <setPie class="toPay" />
      <setPie class="toConfirm" />
      <setPie class="toReply" />
    </div>
  </div>
</template>

<script>
import CommonTitle from "./CommonTitle";
import eventBus from "@/utils/eventBus.js";
export default {
  components: {
    CommonTitle,
  },
  data() {
    return {
      test: [1, 2, 3],
      todolist: [
        {
          title: "待付款订单",
          item1: { val: "", name: "待付款" },
          item2: { val: "", name: "已付款" },
          color: "#418BFE",
          ele: "toPay",
        },
        {
          title: "待确认订单",
          item1: { val: "", name: "待确认" },
          item2: { val: "", name: "已确认" },
          color: "#EA657D",
          ele: "toConfirm",
        },
        {
          title: "待回复客户",
          item1: { val: "", name: "待回复" },
          item2: { val: "", name: "已回复" },
          color: "#FEC241",
          ele: "toReply",
        },
      ],
    };
  },
  props: ["todoDate"],
  watch: {
    todoDate(newV, oldV) {
      var obj = JSON.parse(JSON.stringify(newV));
      this.todolist[0].item1.val = obj.topay;
      this.todolist[0].item2.val = obj.paid;
      this.todolist[1].item1.val = obj.toconfirm;
      this.todolist[1].item2.val = obj.confirmed;
      this.todolist[2].item1.val = obj.toreply;
      this.todolist[2].item2.val = obj.replied;

      this.todolist.forEach((item, index) => {
        eventBus.$emit("touchSetOptions", item);
      });
    },
  },
};
</script>

<style lang="less" scoped>
.container {
  box-sizing: border-box;
  padding: 24px;
  height: 100%;
  overflow: hidden;
  background-color: #fff;
  &:hover h3 {
    color: #438afe;
  }
  .pieBox {
    width: 100%;
    // background-color: yellow;
    height: 180px;
    display: flex;
    align-content: space-around;
    margin-top: -3%;
    .toPay,
    .toConfirm,
    .toReply {
      width: 30%;
      height: 100%;
      // background-color: lightblue;
    }
  }
}
</style>